﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DBO_ShopMob;
using WS_Manager_ShopMob.Helper;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace WS_Manager_ShopMob.Model
{
    /// <summary>
    /// Repository utilisant le webservice
    /// </summary>
    class Repository : IRepository
    {

        /// <summary>
        /// Ip du serveur avec le port
        /// </summary>
        private string ipServer = "10.10.162.60:8080";

        /// <summary>
        /// Dictionnaire contenant la liste des urls disponible
        /// </summary>
        private Dictionary<string, string> urls;

        /// <summary>
        /// Helpers pour appelé le webservice
        /// </summary>
        private WebServiceHelpers wsh;

        /// <summary>
        /// Constructeur standard
        /// </summary>
        public Repository() {
            //on instancie l'hêlpers et on renseingne le dictionnaire
            wsh = new WebServiceHelpers();
            urls = new Dictionary<string, string>();

            urls.Add("addClient", String.Format("http://{0}/back-office/shopmob/addclient", ipServer));
            urls.Add("getClientParID", String.Format("http://{0}/back-office/shopmob/client?id=", ipServer));
            urls.Add("connexion", String.Format("http://{0}/back-office/shopmob/connexion", ipServer));
            urls.Add("getCategorieMere",String.Format("http://{0}/back-office/shopmob/categoriesmere", ipServer));
            urls.Add("getCategorieFille",String.Format("http://{0}/back-office/shopmob/categoriesfille?id=", ipServer));
            urls.Add("getCategorieArticlesByCateg", String.Format("http://{0}/back-office/shopmob/articlesbycateg?id=", ipServer));
            urls.Add("getArticlesByNom", String.Format("http://{0}/back-office/shopmob/articlesbynom?nom=", ipServer));
            
        }

        /// <summary>
        // Voir IRepository
        /// </summary>
        public void GetMagasinForArticle(long id, ResultHandler methodToExec)
        {
            new DebugRepository().GetMagasinForArticle(id, methodToExec);
        }



        public void Connexion(string login, string motdePasse, ResultHandler methodToExec)
        {
            throw new NotImplementedException();
        }

        public void GetClientParID(string login, ResultHandler methodToExec)
        {
            throw new NotImplementedException();
        }

        public void GetCommandeParId(string id, ResultHandler methodToExec)
        {
            throw new NotImplementedException();
        }

        public void GetCommandesEnAttente(ResultHandler methodToExec)
        {
            throw new NotImplementedException();
        }

        public void GetCommandesEnCours(ResultHandler methodToExec)
        {
            throw new NotImplementedException();
        }

        public void GetCommandesTermine(ResultHandler methodToExec)
        {
            throw new NotImplementedException();
        }

        public void GetCommandesParLivreur(long id, ResultHandler methodToExec)
        {
            throw new NotImplementedException();
        }

        public void GetLivreurs(ResultHandler methodToExec)
        {
            throw new NotImplementedException();
        }

        public void GetLivreurs(long id, ResultHandler methodToExec)
        {
            throw new NotImplementedException();
        }
    }
}
